<?php

error_reporting ( E_ALL | E_STRICT );
date_default_timezone_set ( 'Asia/Bangkok' );
set_time_limit ( 0 );

// $dir = realpath(dirname( __FILE__));
// $dir = realpath($dir."/../..");

// defined('ROOT_PATH')||define('ROOT_PATH',$dir);

set_include_path ( '.' . PATH_SEPARATOR . '../library/' . PATH_SEPARATOR . '../application/models' . PATH_SEPARATOR . get_include_path () );


//include Loader file
require_once 'Zend/Loader/Autoloader.php';
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->registerNamespace('D_'); 
//$autoloader->registerNamespace('DB_');//register for database utility classes
$autoloader->setFallbackAutoloader(true); 

Zend_Controller_Action_HelperBroker::addPath("D/Helper", "D_Helper");

Zend_Session::start();


$config = new Zend_Config_Ini('../application/configs/config.ini', 'development');
$registry = Zend_Registry::getInstance();
$registry->set('config',$config);

//ROOT_URL
defined('ROOT_URL')||define('ROOT_URL',$config->rooturl);


//config db
$db = Zend_Db::factory($config->db);
$db->getProfiler()->setEnabled(true);
Zend_Db_Table::setDefaultAdapter($db);

//config logger
$writer = new Zend_Log_Writer_Stream('../log/development.txt');
//$columnMapping = array('priority' => 'priority', 'message' => 'message');
//$writer = new Zend_Log_Writer_Db($db, 'logs', $columnMapping);
//$filter = new Zend_Log_Filter_Priority(Zend_Log::DEBUG);
//$writer->addFilter($filter);
$logger = new Zend_Log($writer);
Zend_Registry::set('logger', $logger);





